"""
演示多线程
"""
import time
import threading


def sing(name: str):
    while True:
        print(f"{name}在唱歌，啦啦啦...")
        time.sleep(1)


def dance(name: str):
    while True:
        print(f"{name}在跳舞，哗哗哗...")
        time.sleep(1)


if __name__ == '__main__':
    # 创建一个唱歌的线程，并以元组的方式给函数传参
    thread_sing = threading.Thread(target=sing, name="sing", args=("张三", ))
    # 创建一个跳舞的线程，并以字典的方式给函数传参
    thread_dance = threading.Thread(target=dance, name="dance", kwargs={"name": "李四"})

    # 启动线程，让线程开始干活
    thread_sing.start()
    thread_dance.start()
